Enter cash ? 50000 Enter credit ? 75000 Car Purchase Approved!!
When execution got to the IF
statement, it found that
CASH >= 25000 --- true, because 50000 >= 25000
and
CREDIT >= 25000 --- true, because 75000 >= 25000
Since all that is required for OR
is one true, the complete
logical expression was TRUE.
The OR is used in a logical expression to insist that there is at least one TRUE. If both sides are true, the entire OR expression is TRUE. If just one side is true, the entire OR expression is TRUE. If both sides are false, the entire OR expression is FALSE. OR is called a logical operator because it combines two TRUE/FALSE values into a single TRUE/FALSE value.
A compact way of saying what OR does is:
OR is used to check that at least one requirement is met.
Here is a logical expression:
34 > 2 OR 5 = 7
Is the complete logical expression TRUE or FALSE?